package org.pay.union.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

@Getter
public enum TradeTypeEnum {
    weixin("pay.weixin.micropay", "WeChat", "微信"),
    alipay("pay.alipay.micropay", "Alipay", "支付宝"),
    unionpay("pay.unionpay.micropay", "unionPay", "云闪付"),
    ;

    TradeTypeEnum(String code, String en, String cn) {
        this.code = code;
        this.en = en;
        this.cn = cn;
    }

    public static TradeTypeEnum codeOf(String code) {
        for (TradeTypeEnum type : TradeTypeEnum.values()) {
            if (StrUtil.contains(code, type.name())) {
                return type;
            }
        }
        return null;
    }

    private String code;
    private String en;
    private String cn;
    private Class<? extends Enum<?>> clazz;

}
